package day04;


class StudentTest{
    public static void main(String[] args) {

        Student zs1 = new Student(); //调用无参构造方法
        Student ls1 = new Student("李四",25); //调用2个参构造
        Student ww = new Student("王五",26,"jsd2302","003"); //调用4个参构造
        zs1.sayHi();
        ls1.sayHi();
        ww.sayHi();


        Student zs =new Student();
        zs.name="张三";
        zs.age=18;
        zs.className="jsd2302";
        zs.stuId="001";
        zs.study();;
        zs.sayHi();
        zs.playWith("李四");


        Student ls =new Student();

        ls.name="李四";
        ls.age=19;
        ls.className="jsd2022";
        ls.stuId="003";
        ls.study();;
        ls.sayHi();
        ls.playWith("张三");

        Student w =new Student();
        w.study();
        w.sayHi();
        w.playWith("张三");
    }
}

public class Student {

    String name;
    int age;
    String className;
    String stuId;

    public Student(String name, int age, String className, String stuId) {
        this.name = name;
        this.age = age;
        this.className = className;
        this.stuId = stuId;
    }

    Student(){

    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    void study(){
        System.out.println(name+"在学习");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+this.name+"今年"+this.age+"岁了，所在班级为"+this.className+",学号为"+this.stuId);

    }
    void playWith(String anotherName){
        System.out.println(this.name+"正在和"+anotherName+"一起玩。。。");
    }

}
